package _interview150;

import java.util.Arrays;

/**
 * 274. H 指数
 */
public class No274 {
    public int hIndex(int[] citations) {
        int n = citations.length;
        Arrays.sort(citations);
        int ans = 0;

        for (int i = n - 1; i >= 0; i--) {
            if (citations[i] >= n - i) ans = n - i;
        }
        return ans;
    }
}
